package com.jiazhong.basic.shuxin.design.单例模式;

import lombok.SneakyThrows;

// 单例模式:懒加载方锁单例模式
public class DemoC {
    private static DemoC instance;

    private DemoC() {
    }

    @SneakyThrows
    public synchronized static DemoC getInstance() {
        if (instance == null) {
            Thread.sleep(1000);
            instance = new DemoC();
        }
        return instance;
    }
}
